﻿@{
    Layout = null;
    ViewBag.Titel = "登录页面";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
    <title>@ViewBag.Titel</title>
    @Styles.Render("~/style-login")
    @Scripts.Render("~/bundles/jquery")
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.cookie.js")"></script>
    <script type="text/javascript">
        function getAjax(url, postData, callback, dataType) {
            postData = postData == undefined ? {} : postData;
            callback = callback == undefined ? function () { } : callback;
            dataType = dataType == undefined ? "json" : dataType;
            $.get(url, postData, callback, dataType);
        }

        function postAjax(url, postData, callback, dataType) {
            postData = postData == undefined ? {} : postData;
            callback = callback == undefined ? function () { } : callback;
            dataType = dataType == undefined ? "json" : dataType;
            $.post(url, postData, callback, dataType);
        }


        /*
        检查浏览器是否支持
        */
        var isIE = !!window.ActiveXObject;
        var isIE6 = isIE && !window.XMLHttpRequest;
        if (isIE6) {
            window.location.href = "../Error/Browser";
        }
        //回车键
        document.onkeydown = function (e) {
            if (!e) e = window.event; //火狐中是 window.event
            if ((e.keyCode || e.which) == 13) {
                var btlogin = document.getElementById("btlogin");
                btlogin.focus();
                btlogin.click();
            }
        }
        $(function () {
            $("#btlogin").click(function () {
                var txtaccount = $("#txtaccount").val();
                var txtpassword = $("#txtpassword").val();
                if (txtaccount == "") {
                    $("#txtaccount").focus();
                    formMessage('登录账户不能为空', 'warning');
                    return false;
                } else if (txtpassword == "") {
                    $("#txtpassword").focus();
                    formMessage('登录密码不能为空', 'warning');
                    return false;
                } else {
                    formMessage('正在登录...', 'succeed');
                    window.setTimeout(function () {
                        var postData = {
                            Account: encodeURI(txtaccount),
                            Password: encodeURI(txtpassword)
                        }
                        postAjax('/Login/CheckLogin', postData, function (json) {
                            if (!json.success) {
                                $("#txtaccount").focus();
                                formMessage(json.msg, 'error');
                                return;
                            }
                            formMessage('登录验证成功,正在跳转首页', 'succeed');
                            setInterval(Load, 1000);
                        });
                    }, 500);
                }
            })
        })
        //登录加载
        function Load() {
            var Index = $.cookie('UItheme');
            if (Index) {
                window.location.href = '/Home/' + Index;
            } else {
                window.location.href = '/Home/Default';
            }
            return false;
        }
        //提示信息
        function formMessage(msg, type) {
            $('.form-message').html('');
            $('.form-message').append('<div class="form-' + type + '-text">' + msg + '</div>');
        }
    </script>

</head>
<body class="Loginbody">
    <div class="logo">
        <img src="/Content/Images/loginlogo.png" />
    </div>
    <div class="content">
        <div class="Loginform">
            <div class="form-message">
            </div>
            <div class="form-account">
                账户
                <input id="txtaccount" type="text" />
            </div>
            <div class="form-password">
                密码
                <input id="txtpassword" type="password" />
            </div>
            <div class="form-bottom">
                <div id="btlogin" class="btlogin"></div>
                <div>测试账户：guest，密码：123456 </div>
                <div>系统账户：System 密码:0000</div>
            </div>
        </div>
    </div>
    <div style="text-align: center; margin: 20px; font-family: Microsoft Yahei; color: #fff; margin: auto; width: 983px; padding-top: 30px;">
        <p>适用浏览器：IE8以上、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. </p>
    </div>
    <div class="copyright">
        yepeng26@qq.com
        <br />
        LR-FDMS 框架官方网站：http://localhost:8000/
    </div>
    <div class="main-im">
        <div id="open_im" class="open-im">&nbsp;</div>
        <div class="im_main" id="im_main">
            <div id="close_im" class="close-im"><a href="javascript:void(0);" title="点击关闭">&nbsp;</a></div>
            <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=463882300&site=qq&menu=yes" class="im-qq qq-a" title="在线QQ客服">
                <div class="qq-container"></div>
                <div class="qq-hover-c">
                    <img class="img-qq" src="/Content/Images/qq.png">
                </div>
                <span>QQ在线咨询</span>
            </a>
            <div class="im-tel">
                <div>咨询热线</div>
                <div class="tel-num">15858127354</div>
                <div>咨询热线</div>
                <div class="tel-num">15858127354</div>
            </div>
            <div class="im-footer" style="position: relative">
                <div class="weixing-container">
                    <div class="weixing-show">
                        <div class="weixing-txt">
                            微信扫一扫<br />
                            关注yepng<br />
                            获取更多消息
                        </div>
                        <img class="weixing-ma" src="/Content/Images/weixing-ma.png">
                        <div class="weixing-sanjiao"></div>
                        <div class="weixing-sanjiao-big"></div>
                    </div>
                </div>
                <div class="go-top"><a href="javascript:;" title="返回顶部"></a></div>
                <div style="clear: both"></div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        //在线客户
        $(function () {
            $('#close_im').bind('click', function () {
                $('#main-im').css("height", "0");
                $('#im_main').hide();
                $('#open_im').show();
            });
            $('#open_im').bind('click', function (e) {
                $('#main-im').css("height", "272");
                $('#im_main').show();
                $(this).hide();
            });
            $('.go-top').bind('click', function () {
                $(window).scrollTop(0);
            });
            $(".weixing-container").bind('mouseenter', function () {
                $('.weixing-show').show();
            })
            $(".weixing-container").bind('mouseleave', function () {
                $('.weixing-show').hide();
            });
            $("#open_im").trigger("click");
            $('.weixing-show').hide();
        })
    </script>
</body>

</html>
